<?php
namespace App\Services\Classes;

class WebService
{
    private $api;
    private $basic;
    private $uri;

    public function __construct()
    {
        loadLibrary('curl.class');
        loadLibrary('common');
    }

    /**
     * call api command
     * @param string $method get|post
     * @param string $command
     * @param array $params
     * @return false|object
     */
    protected function command($method,  $params = [])
    {
        $curl = new \Curl();
        $curl->setSsl();
        $curl->setTimeout(5, 30);
        $url = "http://wms.ccorp.cn/WMSSYS/WMSApi/WMSApiService.ashx?eciaction=WMSApi";
        $data = call_user_func([$curl, $method], $url, $params);
        //$statusCode = $curl->getHttpCode();
        $curl->close();
        $result = json_decode($data);
        return $result;
    }

    public function orderPush($params){
        return $this->command("POST",$params);
    }
}
